use std::collections::HashMap;
use crate::core::model::{Board, Component, ComponentType, Toolpath};

pub trait MachiningStrategy {
    fn generate_toolpath(&self, component: &Component, board: &Board) -> Vec<Toolpath>;
}

// 策略注册器
pub struct StrategyRegistry {
    strategies: HashMap<ComponentType, Box<dyn MachiningStrategy>>,
}

impl StrategyRegistry {
    pub fn new() -> Self {
        Self {
            strategies: HashMap::new(),
        }
    }

    pub fn register(&mut self, component_type: ComponentType, strategy: Box<dyn MachiningStrategy>) {
        self.strategies.insert(component_type, strategy);
    }

    pub fn get(&self, component_type: &ComponentType) -> Option<&Box<dyn MachiningStrategy>> {
        self.strategies.get(component_type)
    }
}